package com.baifc.wiringbean.soundsystem;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * projectName: spring-in-action
 * packageName: soundsystem
 * Created: 2019/4/22.
 * Auther: baifc
 * Description:
 */
//@Component
public class CDPlayer implements MediaPlayer {


    private CompactDisc compactDisc;

    // 构造函数注入
//    @Autowired
    public CDPlayer(CompactDisc compactDisc) {
        this.compactDisc = compactDisc;
    }


    public void play() {
        compactDisc.play();
    }

//    @Autowired
//    public void setCompactDisc(CompactDisc compactDisc) {
//        this.compactDisc = compactDisc;
//    }
}
